package com.jlu155.CourseManager.repository;

import java.util.List;

import com.jlu155.CourseManager.entity.College;
import org.apache.ibatis.annotations.*;

public interface CollegeRepository {

    // 插入学院信息
    @Insert("insert into college(college_id, name) values (#{college_id}, #{name})")
    public int insertCollege(College college);

    // 按学院ID查询学院信息
    @Select("select * from college where college_id=#{college_id}")
    College findCollegeById(Integer college_id);

    // 按学院名称查询学院信息
    @Select("select * from college where name like CONCAT('%', #{name}, '%')")
    List<College> findCollegeByName(String name);

    // 删除学院信息
    @Delete("delete from college where college_id=#{college_id}")
    public boolean deleteCollege(Integer college_id);

    // 查询所有学院信息
    @Select("select * from college")
    public List<College> findAllColleges();

    // 更新学院信息
    @Update("update college set name=#{name} where college_id=#{college_id}")
    public boolean updateCollege(College college);
}
